<?php
namespace app\ai\controller;
use think\facade\Validate;

class Index
{

    public function index()
    {
		halt($_REQUEST);
    }

    public function hello($name = 'ThinkPHP5')
    {
        return 'hello,' . $name;
    }
    public function login()
    {
        header('Access-Control-Allow-Origin:*');
      file_put_contents('accet.log',file_get_contents('php://input'));
      halt(request()->file('file'));
      //return json_decode(file_get_contents('php://input'));
        //$data = $_POST['data'];
        $user = $_POST['user'];
        $password = $_POST['password'];
        $check = Validate::check(['user'=>$user,'password'=>$password],['user'=>'require','password'=>'require']);
        if(!$check){
            return Validate::getError();
        }

        if($user == 'user' && $password == '123456'){
            return ['code'=>200,'msg'=>'success'];
        }else{
            return ['code'=>400,'msg'=>'error'];
        }

    }

}
